////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once

#ifndef __WN_SCRIPTING_EXPRESSION_LIST_H__
#define __WN_SCRIPTING_EXPRESSION_LIST_H__

#include "WNScripting/inc/WNParseNode.h"
#include "WNScripting/inc/WNTypeManager.h"

namespace llvm {
    class Value;
}

namespace WNScripting {
    class WNExpression;

    class WNExpressionList : public WNParseNode {
    public:
        struct WNExpressionListVal {
            WNExpression* mExpr;
            llvm::Value* mLlvmVal;
        };

        virtual ~WNExpressionList();

        WNExpressionList(WN_SIZE_T _startLine,
                         WN_SIZE_T _endLine,
                         WN_SIZE_T _startChar,
                         WN_SIZE_T _endChar,
                         WNExpression* _expr);

        WNExpressionList(WN_SIZE_T _startLine,
                         WN_SIZE_T _endLine,
                         WN_SIZE_T _startChar,
                         WN_SIZE_T _endChar,
                         WNExpressionList* _exprList,
                         WNExpression* _expr);

        llvm::Value* OptimizeAndGenerate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl);
        WN_VOID GetExpressions(std::vector<WNExpressionListVal>& _outList) const;

    private:
        WN_VOID OptimizeAndGeneratePrivate(WNScriptingEngineData& _scriptingData, WNFunctionDecl* _functionDecl, std::vector<WNExpressionListVal>& _fillList);
        std::vector<WNExpressionListVal> mExpressions;
        WNExpression* mExpression;
        WNExpressionList* mSubList;
    };
}
#endif // __WN_SCRIPTING_FUNCTION_HEADER_LIST_H__